package com.ekuaitu.kuaitustaff.api;

import com.ekuaitu.kuaitustaff.bean.CancelOrderBean;
import com.ekuaitu.kuaitustaff.bean.CarBleBean;
import com.ekuaitu.kuaitustaff.bean.CarCheckUserIsPreOrderBean;
import com.ekuaitu.kuaitustaff.bean.CarCheckoutTaskBean;
import com.ekuaitu.kuaitustaff.bean.CarOrderBean;
import com.ekuaitu.kuaitustaff.bean.CarPositionYingYan;
import com.ekuaitu.kuaitustaff.bean.CarQueryStationBean;
import com.ekuaitu.kuaitustaff.bean.CarQuerylicenseBean;
import com.ekuaitu.kuaitustaff.bean.CarReceiveOrderListBean;
import com.ekuaitu.kuaitustaff.bean.CarTaskDetailBean;
import com.ekuaitu.kuaitustaff.bean.CarTaskStateBean;
import com.ekuaitu.kuaitustaff.bean.CarTaskfinishBean;
import com.ekuaitu.kuaitustaff.bean.CarTrackBean;
import com.ekuaitu.kuaitustaff.bean.CarUnfinishOrderCountBean;
import com.ekuaitu.kuaitustaff.bean.ConfigBean;
import com.ekuaitu.kuaitustaff.bean.DestinationBean;
import com.ekuaitu.kuaitustaff.bean.FindRecentReportBean;
import com.ekuaitu.kuaitustaff.bean.GetCodeBean;
import com.ekuaitu.kuaitustaff.bean.InitAppBean;
import com.ekuaitu.kuaitustaff.bean.LogInBeanNew;
import com.ekuaitu.kuaitustaff.bean.MakerIconBean;
import com.ekuaitu.kuaitustaff.bean.ParseResultBean;
import com.ekuaitu.kuaitustaff.bean.ResultBean;
import com.ekuaitu.kuaitustaff.bean.ReturnCarCommentBean;
import com.ekuaitu.kuaitustaff.bean.SpecialOrderBean;
import com.ekuaitu.kuaitustaff.bean.StaffOrderBean;
import com.ekuaitu.kuaitustaff.bean.UploadImageBaidu;
import com.ekuaitu.kuaitustaff.bean.UserInforBean;
import com.ekuaitu.kuaitustaff.bean.lastUserLocation;
import com.google.gson.JsonObject;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;

/**
 * Created by micha on 2016/9/21.
 */
public interface ApiService {

    //单车围栏
    @FormUrlEncoded
    @POST("staff/staff/v/staff-city/init-app?")
    Call<InitAppBean> initApp(@FieldMap Map<String, String> map);

    @FormUrlEncoded
    @POST("staff/staff/v/staff-order/receive?")
    Call<ResultBean> receiveOrder(@FieldMap Map<String, String> map, @Field("orderId") String orderId,
                                  @Field("businessType") String businessType, @Field("reciveType") String reciveType, @Field("orderIndex") int orderIndex);

    //取消工单
    @FormUrlEncoded
    @POST("staff/staff/v/staff-order/cancelWorkOrder")
    Call<CancelOrderBean> cancelOrder(@FieldMap Map<String, String> map,
                                      @Field("businessType") String businessType, @Field("workOrderId") String workOrderId);

    //关单上线
    @FormUrlEncoded
    @POST("staff/staff/v/staff-order/closeWorkOrder")
    Call<ResultBean> closeOrder(@FieldMap Map<String, String> map,
                                @Field("businessType") String businessType, @Field("workOrderId") String workOrderId, @Field("carId") String carId, @Field("remarks") String remarks, @Field("frontLeft") String frontLeft, @Field("backRight") String backRight, @Field("frontSeat") String frontSeat, @Field("backSeat") String backSeat, @Field("newTask") String newTask, @Field("bleResult") String bleResult);

    @FormUrlEncoded
    @POST("staff/staff/v/car/control")
    Call<ResultBean> controlCar(@FieldMap Map<String, String> map, @Field("orderId") String orderId, @Field("carId") String carId, @Field("command") String command, @Field("businessType") String businessType);

    //一键接单
    @FormUrlEncoded
    @POST("staff/staff/v/stafforder/oneKeyReciveOrder")
    Call<CarTaskDetailBean> oneKeyReciveOrder(@FieldMap Map<String, String> map);

    //工单列表
    @GET("staff/staff/v/staff-order/get-around")
    Call<CarOrderBean> getCarOrder(@QueryMap Map<String, String> map,
                                   @Query("businessType") String businessType, @Query("page") String page, @Query("pageSize") String pageSize);

    //是否有进行中的工单(新)
    @FormUrlEncoded
    @POST("staff/staff/v/staffOrder/new/unfinishOrder")
    Call<CarTaskStateBean> unfinishOrder(@FieldMap Map<String, String> map);

    //调度工单是否有人预约接口
    @FormUrlEncoded
    @POST("staff/staff/v/car/checkUserIsPreOrderCar")
    Call<CarCheckUserIsPreOrderBean> checkUserIsPreOrderCar(@FieldMap Map<String, String> map, @Field("carId") String carId, @Field("staffOrderId") String staffOrderId);

    //开门检查提交接口(新)
    @FormUrlEncoded
    @POST("staff/staff/v/stafforder/new/checkCarB4DealOrder")
    Call<StaffOrderBean> stafforder(@FieldMap Map<String, String> map, @Field("staffOrderId") String staffOrderId, @Field("carId") String carId, @Field("type") String type, @Field("remark") String remark, @Field("frontLeft") String frontLeft, @Field("backRight") String backRight, @Field("frontSeat") String frontSeat, @Field("backSeat") String backSeat);

    //任务列表接口
    @FormUrlEncoded
    @POST("staff/staff/v/staff-task/confirm")
    Call<CarTaskfinishBean> confirm(@FieldMap Map<String, String> map, @Field("workOrderId") String workOrderId, @Field("carId") String carId);

    //登录（新接口）
    @FormUrlEncoded
    @POST("staff/staff/login/mobile-login")
    Call<LogInBeanNew> logIn(@FieldMap Map<String, String> map, @Field("phoneNum") String phoneNum, @Field("code") String code);

    //获取验证码
    @FormUrlEncoded
    @POST("staff/staff/login/getCode")
    Call<GetCodeBean> getCode(@FieldMap Map<String, String> map, @Field("phoneNum") String phoneNum);

    //获取蓝牙信息
    @FormUrlEncoded
    @POST("staff/staff/v/staffBluetooth/bluetoothInfo")
    Call<CarBleBean> getCarBleInfo(@FieldMap Map<String, String> map, @Field("carId") String carId);

    //根据车牌号查询工单
    @FormUrlEncoded
    @POST("staff/staff/v/staff-task/query-license")
    Call<CarQuerylicenseBean> queryLicense(@FieldMap Map<String, String> map, @Field("license") String license);

    //个人信息
    @FormUrlEncoded
    @POST("staff/staff/v/user/userInfo")
    Call<UserInforBean> userInfo(@FieldMap Map<String, String> map);

    //获取上传图片的key和token
    @FormUrlEncoded
    @POST("staff/staff/bce/getsts")
    Call<UploadImageBaidu> uploadImageBaidu(@FieldMap Map<String, String> map, @Field("command") String command, @Field("type") String type);

    //已接工单列表(新)
    @FormUrlEncoded
    @POST("staff/staff/v/staff-order/new/my-order-list")
    Call<CarReceiveOrderListBean> getReceiveOrderList(@FieldMap Map<String, String> map, @Field("businessType") String businessType, @Field("page") String page, @Field("pageSize") String pageSize);

    //已接工单列表个数
    @FormUrlEncoded
    @POST("staff/staff/v/staffOrder/unfinishOrderCount")
    Call<CarUnfinishOrderCountBean> getunfinishOrderCount(@FieldMap Map<String, String> map);

    //根据坐标提供附近2公里的工单
    @FormUrlEncoded
    @POST("staff/staff/v/staff-order/searchCarOrderByRange")
    Call<CarOrderBean> searchCarOrderByRange(@FieldMap Map<String, String> map, @Field("businessType") String businessType, @Field("endLatitude") String endLatitude, @Field("endLongitude") String endLongitude, @Field("workOrderId") String workOrderId, @Field("electricPileModels") String electricPileModels);

    //强制关单接口
    @FormUrlEncoded
    @POST("staff/staff/v/staff-order/forceCloseWorkOrder")
    Call<ResultBean> forceCloseWorkOrder(@FieldMap Map<String, String> map, @Field("businessType") String businessType, @Field("workOrderId") String workOrderId, @Field("carId") String carId, @Field("remarks") String remarks, @Field("frontLeft") String frontLeft, @Field("backRight") String backRight, @Field("frontSeat") String frontSeat, @Field("backSeat") String backSeat, @Field("newTask") String newTask);

    //搭电工单查询电量
    @FormUrlEncoded
    @POST("staff/staff/v/car/checkCarVoltage")
    Call<ResultBean> checkCarVoltage(@FieldMap Map<String, String> map, @Field("workOrderId") String workOrderId, @Field("carId") String carId);

    //.查询附近充电站或加油站
    @FormUrlEncoded
    @POST("staff/staff/v/staff-city/queryStation")
    Call<CarQueryStationBean> queryStation(@FieldMap Map<String, String> map, @Field("latitudeCar") String latitudeCar, @Field("longitudeCar") String longitudeCar, @Field("type") String type);

    //退出登陆
    @FormUrlEncoded
    @POST("staff/staff/v/user/logout")
    Call<ResultBean> logout(@FieldMap Map<String, String> map);

    @Headers({"Content-Type: application/json", "Accept: application/json"})//需要添加头
    @POST("classes/ActionEvent")
    Call<ParseResultBean> parseEvent(@Body RequestBody event);

    //完成任务校验
    @FormUrlEncoded
    @POST("staff/staff/v/staff-task/checkout")
    Call<CarCheckoutTaskBean> checkoutTask(@FieldMap Map<String, String> map, @Field("staffCarOrderId") String staffCarOrderId);

    //开门记录接口
    @FormUrlEncoded
    @POST("staff/staff/v/stafforder/new/openRecord")
    Call<ResultBean> openRecord(@FieldMap Map<String, String> map, @Field("staffCarOrderId") String staffCarOrderId, @Field("bleCon") String bleCon);

    //蓝牙操作记录接口
    @FormUrlEncoded
    @POST("staff/staff/v/staffBluetooth/record")
    Call<ResultBean> bleRecord(@FieldMap Map<String, String> map, @Field("staffCarOrderId") String staffCarOrderId, @Field("carId") String carId, @Field("command") String command, @Field("bleId") String bleId, @Field("bleResult") String bleResult, @Field("bluetoothVersion") String bluetoothVersion, @Field("phoneModel") String phoneModel);

    //获取最后使用者的定位
    @GET("staff/staff/v/car/position/lastUser")
    Call<lastUserLocation> getlastUserLocation(@QueryMap Map<String, String> map, @Query("carId") String carId);

    //获取marker图片
    @FormUrlEncoded
    @POST("staff/staff/v/staff-task/pinIcons")
    Call<MakerIconBean> getMakerIcon(@FieldMap Map<String, String> map);

    //加油完成目的地接口
    @FormUrlEncoded
    @POST("staff/staff/v/staff-order/refueling")
    Call<DestinationBean> getDestination(@FieldMap Map<String, String> map, @Field("staffOrderId") String staffOrderId);

    //获取送车上门marker
    @GET("staff/staff/v/staff-order/special-orders")
    Call<SpecialOrderBean> getSpecialOrders(@QueryMap Map<String, String> map);

    //parse log
    @Headers({"Content-Type: application/json", "Accept: application/json"})//需要添加头
    @POST("classes/BLELogEvent")
    Call<ParseApiStore> parseBleLog(@Body RequestBody requestBody);

    @POST("classes/carBinding")
    Call<ParseResultBean> carBinding(@Body RequestBody event);

    //还车备注
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("epimetheus/v1/rcc")
    Call<ReturnCarCommentBean> returnCarComment(@Body RequestBody event);

    //获取还车备注
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @GET()
    Observable<ReturnCarCommentBean> getReturnCarComment(@Url String url);

    //app config
    @GET("v1/config/staff")
    Call<ConfigBean> appConfig(@Query("version") String version, @Query("platform") String platform);

    //行车轨迹()
    @GET("ground-map/track/getLatestPoins/stuff")
    Call<CarTrackBean> getCarTrack(@QueryMap Map<String, String> map, @Query("carId") String carId);

    //车辆所有图标
    @GET("api-oms/multi-city/v1/city/vehicle-icon")
    @Headers({"x-incar-request-uri:multi-city/v1/city/vehicle-icon"})
    Observable<JsonObject> getAllIcon(@QueryMap Map<String, String> map);

    //地网鹰眼服务获取车位置
    @POST("ground-yingyan/track/getLatestPoint")
    Call<CarPositionYingYan> getCarPosition(@Body RequestBody requestBody);

    //修改还车备注
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @GET()
    Call<ReturnCarCommentBean> getCommentByLicense(@Url String url);

    //创建还车备注的评价
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST()
    Call<ReturnCarCommentBean> commitCommentEvaluate(@Url String url, @Body RequestBody event);

    //获取最近上报的车损
    @Headers({"Content-Type: application/json", "Accept: application/json", "X-Parse-Application-Id:buYPix4muDiMmfBeJRLJexaU", "X-Parse-REST-API-Key:XReRMP8sgCnPWgJcEGxovUCM", "X-Parse-JavaScript-Key:LNEiVZYMwLpUVZiLjcpTh2gc"})
    @POST("tiny/parse/functions/findRecentReport")
    Call<FindRecentReportBean> findRecentReport(@Body RequestBody event);

}